<template>
	<view class="coupoBox">
		<span class="Equitycoupon">热门优惠券</span>
		<view class="coupoList">
			<view class="coupoListBox" v-for="(item ,index) in goodsdata" :key="index" @click="toHospital(item.id)">
				<view class="coupoListImg">
					<image class="coupoBoximg" :src="item.icon" mode=""></image>
				</view>
				<view class="coupoListText">
					<view class="coupoListite">{{item.name}}</view>
					<view>
						<span style="color: red;font-size: 24rpx;">￥</span>
						<span style="color: red;font-weight: 600; ">{{item.lowestSalePrice}}</span>
						<span style="font-size: 24rpx;">起</span>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script setup>
	import { ref,reactive,computed,toRaw, onMounted } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { goodsList } from '@/common/js/api.js'
	const app = getApp()
	const goodsdata = ref([])
	const data = ref({
		categoryId: '',
		name: '',
		type: '',
		status: '',
		merchantId: '',
		page: 1,
		size: 10,
	})

	// 请求列表
	onLoad(() => {
		goodsList(data.value).then((res) => {
			console.log('成功', res);
			goodsdata.value = res.rows
		}).catch((err) => {
			console.error('失败', err);
		})
	})

	const toHospital = (e) => {
		console.log(e,'id')
		uni.navigateTo({
			url: '/pages/particulars/index?id='+ e
		})
	}


</script>
<style>
	.coupoBox {
		margin-top: 15px;
	}

	/* 优惠券 */
	.Equitycoupon {
		color: #333;
		font-size: 16px;
		font-weight: bold;
		margin-top: 15px;
	}

	.coupoList {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	/* 列表 */
	.coupoListBox {
		margin-bottom: 20rpx;
		height: 474rpx;
		width: 340rpx;
		background-color: #fff;
		border-radius: 15rpx;
	}

	.coupoListImg {
		width: 340rpx;
		height: 348rpx;
	}

	.coupoBoximg {
		width: 100%;
		height: 100%;
		/* border-radius: 15rpx; */
		border-radius: 15rpx 15rpx 0 0;
	}

	.coupoListText {
		padding: 20rpx;
		/* padding: */
	}

	.coupoListite {
		font-size: 28rpx;
		color: #222;
		font-weight: bold;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>